const express = require('express');
const router = express.Router();
const { check } = require('express-validator');
const postController = require('../controllers/postController');
const authMiddleware = require('../middleware/auth');

router.post(
    '/',
    authMiddleware,
    [check('content').notEmpty().withMessage('Content is required')],
    postController.create
);

router.get('/:post_id', postController.getById);

router.get('/user/:user_id', postController.getByUserId);

module.exports = router;